'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	let apiUrl = 'https://v2.alapi.cn/api/tophub'
	const{
		data:data1
	}  = await uniCloud.httpclient.request(apiUrl, {
		method: 'GET',
		data: {
			id:"VaobJ98oAj",
			token: "K8NVh0xvERNNSX1l"
		},
		contentType: 'json',
		dataType: 'json'
	})
	
	if (data1.code === 200) {
		console.log(data1);
		let res = await db.collection('weibo').add({
			wb_news_ht:data1.data,
			date:+new Date()
		})
	}
};
